package com.zzjc.web.config;

import com.google.common.util.concurrent.ThreadFactoryBuilder;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.concurrent.*;


@Configuration
@EnableCaching
@ConfigurationProperties(prefix = "sys.config")
@Component
@Slf4j
@Data
public class GlobalConfig {
    private ThreadFactory serialThreadFactory = new ThreadFactoryBuilder().setNameFormat("serial-service-pool-%d").build();
    private ThreadFactory alarmThreadFactory = new ThreadFactoryBuilder().setNameFormat("alarm-service-pool-%d").build();
    private final ExecutorService serialThreadPool = new ThreadPoolExecutor(1,
            3, 20000L, TimeUnit.MILLISECONDS,
            new LinkedBlockingQueue<>(2000), serialThreadFactory,
            new ThreadPoolExecutor.AbortPolicy());

    private final ExecutorService alarmThreadPool = new ThreadPoolExecutor(2,
            3, 2000L, TimeUnit.MILLISECONDS,
            new LinkedBlockingQueue<>(2000), alarmThreadFactory,
            new ThreadPoolExecutor.AbortPolicy());

    private final ExecutorService singleThreadPool = Executors.newSingleThreadExecutor();

    private String webServerUrl;
//    private String notifyUrl;
//    private String account;
//    private String pwd;
//    private String templateId;
//    private String signId;
//
//    private String faceUploadPathWin;
//    private String faceUploadPath;
//    private String alarmUploadPathWin;
//    private String alarmUploadPath;
//    private String alarmRelativePath;
//    private String alarmWebPath;
//    private String historyVideoPathWin;
//    private String historyVideoPath;
//    private String mergedVideoPathWin;
//    private String mergedVideoPath;
//    private String mergedRelativePath;
//    private String mergedWebPath;
//    private String ffmpegPathWin;
//    private String ffmpegPath;
//
//    private String appId;
//    private String appSecret;
//    private long accessTokenCache;

}


